package com.question.java.time.exec01;

import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import java.time.ZonedDateTime;

/**
 * @Description: 为LocalDateTime添加时区
 * @Author: Jun Yang
 */
public class DateTimeExample04 {
    public static void main(String[] args) {
        LocalDateTime dateTime = LocalDateTime.of(2018, Month.NOVEMBER,
                20, 16, 20, 40);
        ZonedDateTime zdt = dateTime.atZone(ZoneId.of("Asia/Shanghai"));
        System.out.println(zdt);

        //查找另一个时区的日期和时间
        ZonedDateTime landon = zdt.withZoneSameInstant(ZoneId.of("Europe/London"));
        System.out.println(landon);

    }
}
